<?php
/**
 * RepairTaskMsgtpl报修计划任务发送消息
 * @author hjc19850430@gmail.com
 */
class RepairTaskMsgtpl extends BaseMsgtpl
{
	/**
	 * 计划任务下发送消息
	 * @param array $wechatInfo		微信信息
	 * @param array $orderInfo		订单信息
	 * @param array $templet		报修模版配置信息oOwnZtwrlReqnJ2h5mmqTh3LGxmc
	 */
	public function sendMsg($wechatInfo,$orderInfo,$templet,$openid)
	{
		$url = C('site_url').'/index.php?g=base&m=repair&a=orderDetail&repairId='.$orderInfo['repair_id'].'&order_id='.$orderInfo['order_id'];
		
		if($wechatInfo['account_id'] == 2){
			$this->wxTplSign = 'D3IHmxcLckGTHiXw-LDlApX9VIWdOvcZgVqyunmESjo';
		}elseif($wechatInfo['account_id'] == 5){
			$this->wxTplSign = '4EeswD5oYCEQJi2u8AOzAQrflX5aCQVxFOcr592-fvY';
		}elseif($wechatInfo['account_id'] == 6){
			$this->wxTplSign = 'y2OZQJsNL3wXLOrbTuXzuX2x5IVT_ZDsLodN3Mpzyug';
		}elseif($wechatInfo['account_id'] == 4){  //测试服
			$this->wxTplSign = 'k203JXlZ8F8SCYUIR3uH_HBL8Uq2aAMbAIv2N1r46ec';
		}elseif($wechatInfo['account_id'] == 10){  //铁道部
			$this->wxTplSign = 'RUdkrbYCT4fM8eYiEzMGoFrdj7tM2g9YI_Px4xaxETU';
		}/*elseif($wechatInfo['account_id'] == 28){
			$this->wxTplSign = '_hHj0eU1ZQ7yorFomzpQvFV21NxQj8S_bqolOO9sbBk';
		}*/elseif($wechatInfo['account_id'] == 3){
			$this->wxTplSign = 'Xip28HCL4EbvNB6bItDLrIheQnOceLI87-ZDE5f4m0A';
		}elseif($wechatInfo['account_id'] == 17){
				$this->wxTplSign = 'nr3BnPPtM-TA11B537yEf9_CRIV9KXbL9wn7lDJxWFg';
		}elseif($wechatInfo['account_id'] == 11){
				$this->wxTplSign= '0NSi0BNiF-5mrwd9MODtQ86jzp9G93DNnThFSTuXAiQ';
		}elseif($wechatInfo['account_id'] == 28){
				$this->wxTplSign = '-o2OC55fvrdUsNuXd0wFsM2hO3Rn8ey277dCpJTg3JI';
			}
		if($wechatInfo['account_id'] == 4){
			$info = array(
				'first' => array("value" => '您有新的派单，请在您的维修广场查看！','color' => '#173177'),
				'keyword1' => array("value" => $orderInfo['order_sn'] ),
				'keyword2' => array("value" => date("Y-m-d H:i:s")),
				'keyword3' => array("value" => date("Y-m-d H:i:s", strtotime("+1 hour")), "color" => "#173177" ),
				'remark' => array("value" => "您有新的派单，请点击查看！","color" => "#173177")
			);
		}elseif($wechatInfo['account_id'] == 11 || $wechatInfo['account_id'] == 28){
			$info = array(
						'first' => array("value" => '您有新的派单，请在您的维修广场查看！', 'color' => '#173177'),
						'keyword1' => array("value" => $orderInfo['order_sn'] ),
						'keyword2' => array("value" => '无人接单' ),
						'keyword3' => array("value" => date("Y-m-d H:i:s")),
						'remark' => array("value" => "请点击查看！","color" => "#173177"),
					);
		}else{
			$info = array(
				'first' => array("value" => '您有新的派单，请在您的维修广场查看！', 'color' => '#173177'),
				'keyword1' => array("value" => $orderInfo['real_name']),
				'keyword2' => array("value" => date("Y-m-d H:i:s"), "color" => "#173177"),
				'keyword3' => array("value" => date("Y-m-d H:i:s", strtotime("+1 hour")), "color" => "#173177"),
				'remark' => array("value" => "您有订单未确认，请点击确认", "color" => "#173177")
			);
		}
		$result = $this->wxObj->messageTpl($wechatInfo['appid'], $wechatInfo['appsecret'], $openid, $this->wxTplSign, $info, $url);
		return $result;
	}

}
